<!-- 查看投票界面 -->
<template>
  <div class="cards">
    <vote-item
      v-for="(item, index) of voteData"
      :key="index"
      :id="item.voteId"
      :title="item.title"
      :image="item.image"
      :description="item.description"
      :duration="item.startTime + ' 至 ' + item.endTime"
    ></vote-item>
  </div>
</template>

<script>
import VoteItem from "@/components/VoteItem/index.vue";

export default {
  components: { VoteItem },
  data() {
    return {
      allInfo: {
        page: 0,
        pageSize: 10,
        title: "",
      },
      total: 0,
      voteData: [],
    };
  },
  methods: {
    getAllVote() {
      this.$store
        .dispatch("vote/all", this.allInfo)
        .then((res) => {
          this.voteData = res.data;
          this.total = res.size;
        })
        .catch(() => {
          this.loading = false;
        });
    },
  },
  created() {
    this.getAllVote();
  }
};
</script>

<style scoped>
</style>